$(function(){
    $("#sophia").fullpage({
        controlArrows:false,
        continuousVertical:false,
        navigation:true,
        afterLoad:function(anchorLink,index){
            if(index==1){

            }else if(index==2){
                $("#suit").animate({left:"0px",top:"0px",opacity:"1"},1500,"swing");
                $("#dress").animate({top:"0px",opacity:"1"},1500,"swing");
                $("#double").animate({right:"0px",top:"0px",opacity:"1"},1500,"swing");
                $("#team").animate({right:"0px",bottom:"0px",opacity:"1"},1500,"swing")
            }else if(index==3){
                $("#focusbox").animate({width:"1200px"},2000);
                $(".focusBox").animate({width:"1200px"},2000);
                $(".focusBox .pic img").animate({width:"1200px"},2000,"swing");
            }else if(index==4){
                $("#sleetless").animate({left:"0px",opacity:"1",top:"0px"},1500,"swing");
                $("#rose").animate({opacity:"1"},1500);
                $("#secret").animate({right:"0px",opacity:"1",bottom:"0px"},1500,"swing");
                $("#intro").animate({width:"1200px"},1500);
            }else if(index==5){
                $("#inscence div img").animate({width:"215px",height:"280px"},1500,function(){
                    $.each($(this),function(){
                        $(this).parent("div").delay(1000).addClass("ins");
                        $(this).css({transition:" all .5s linear","position":"absolute",left:"43px"});
                    })
                });
            }else if(index==6){
                $("#micro1").delay(500).animate({left:"0px"},1500,"swing");
                $("#micro2").animate({bottom:"0px"},1500,"swing");
                $("#micro3").delay(500).animate({right:"0px"},1500,"swing");
            }else if(index==7){
                $("#cusleft").animate({left:"0px"},1500,"swing");
                $("#cus1").animate({left:"0px",top:"0px"},1500,"swing");
                $("#cus2").animate({right:"0px",top:"0px"},1500,"swing");
                $("#cus3").animate({left:"0px",bottom:"0px"},1500,"swing");
                $("#cus4").animate({right:"0px",bottom:"0px"},1500,"swing");
                $("#cusrit2").animate({bottom:"0px"},1500,"swing");
            }else if(index==8){
                $("#event1").animate({left:"0px"},1500,"swing");
                $("#event2").animate({right:"0px"},1500,"swing");
                $("#foot_con").animate({width:"1200px"},1500,"swing");
            }
        },
        onLeave:function( index,nextIndex,direction ){
            if(index==1){

            }else if(index==2){
                $("#suit").animate({left:"-100%",top:"-100%",opacity:"0"},1500,"swing");
                $("#dress").animate({bottom:"-600px",opacity:"0"},1500,"swing");
                $("#double").animate({right:"-100%",top:"-100%",opacity:"0"},1500,"swing");
                $("#team").animate({right:"-100%",bottom:"-100%",opacity:"0"},1500,"swing")
            }else if(index==3){
                $("#focusbox").animate({width:"0px"},2000,"swing");
                $(".focusBox").animate({width:"0px"},2000);
                $(".focusBox .pic img").animate({width:"0px"},2000,"swing");
            }else if(index==4){
                $("#sleetless").animate({left:"-100%",opacity:"0",top:"-100%"},1500,"swing");
                $("#rose").animate({opacity:"0"},1500);
                $("#secret").animate({right:"-100%",opacity:"1",bottom:"-100%"},1500,"swing");
                $("#intro").animate({width:"0px"},1500);
            }else if(index==5){
                $("#inscence div img").animate({width:"0px",height:"0px"},1500,function(){
                    $.each($(this),function(){
                        $(this).parent("div").removeClass("ins");
                        $(this).css({transition:" all 0s linear"});
                    })
                });
            }else if(index==6){
                $("#micro1").delay(500).animate({left:"-100%"},1500,"swing");
                $("#micro2").animate({bottom:"-400px"},1500,"swing");
                $("#micro3").delay(500).animate({right:"-100%"},1500,"swing");
            }else if(index==7){
                $("#cusleft").animate({left:"-100%"},1500,"swing");
                $("#cus1").animate({left:"-100%",top:"-100%"},1500,"swing");
                $("#cus2").animate({right:"-100%",top:"-100%"},1500,"swing");
                $("#cus3").animate({left:"-100%",bottom:"-100%"},1500,"swing");
                $("#cus4").animate({right:"-100%",bottom:"-100%"},1500,"swing");
                $("#cusrit2").animate({bottom:"-100%"},1500,"swing");
            }else if(index==8){
                $("#event1").animate({left:"-100%"},1500,"swing");
                $("#event2").animate({right:"-100%"},1500,"swing");
                $("#foot_con").animate({width:"0px"},1500,"swing");
            }
        }
    });
    setInterval(function(){
            $.fn.fullpage.moveSlideRight();
         }, 3000);
    $(".focusBox").hover(function(){ jQuery(this).find(".prev,.next").stop(true,true).fadeTo("show",0.2) },function(){ jQuery(this).find(".prev,.next").fadeOut() });
    $(".focusBox").slide({ mainCell:".pic",effect:"fold", autoPlay:true, delayTime:600, trigger:"click"});
    $(".microflim>div").hover(function(){
        $(this).find("img").attr("src","images/play2.fw.png");
        $(this).find(".text").css("color","#ff0000");
    },function(){
        $(this).find("img").attr("src","images/play1.fw.png");
        $(this).find(".text").css("color","#333");
    })
    $("#inscence>div").mouseover(function(){
        $(this).siblings().css("z-index","-10");
    }).mouseout(function(){
        $(this).siblings().delay(1000).css("z-index","1");
    })
    $(".tabs li ").hover(function(){
        $(this).find("p").animate({top:"15px"},500).css("color","#aa0000");
        $(this).find("span").animate({top:"-20px"},500);
    },function(){
        $(this).find("p").animate({top:"0px"},500).css("color","#666");
        $(this).find("span").animate({top:"0px"},500);
    })
})

